<%@page import="java.util.*"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
  to.jsp:<br>
  <jsp:useBean id="article_p"  class="entity.Article" scope="page"></jsp:useBean>
 <jsp:useBean id="article_r"  class="entity.Article" scope="request"></jsp:useBean>
  <jsp:useBean id="article_s"  class="entity.Article" scope="session"></jsp:useBean>
   <jsp:useBean id="article_a"  class="entity.Article" scope="application"></jsp:useBean>

<%
  String[] arr = new String[]{"a","b","c"};
  pageContext.setAttribute("arr", arr);
  
  Map map = new HashMap();
  map.put("key1", "val1");
  
  pageContext.setAttribute("map", map);
  
  List list = new ArrayList();
  list.add("1");
  list.add("2");
  
  
  pageContext.setAttribute("list", list);
  
  //没有声明作用域时搜索顺序：  page->request->session->application
  pageContext.setAttribute("username", "username-pageScope");
  request.setAttribute("username", "username-requestScope");
  session.setAttribute("username", "username-sessionScope");
  application.setAttribute("username", "username-applicationScope");
  
%>
<br><br>
${username }<br>
sessionScope:${sessionScope.username }
<br><br>

${ pageScope.arr[0]}<br>
${ pageScope.list[0]}<br>
${ pageScope.map["key1"]}<br>

<br><br><br>
<jsp:getProperty property="content" name="article_p" /><br>
pageScope:${pageScope.article_p.content }<br>
<br>
<jsp:getProperty property="content" name="article_r" /><br>
requestScope:${requestScope.article_r.content }<br>
<br>
<jsp:getProperty property="content" name="article_s" /><br>
sessionScope:${sessionScope.article_s.content }<br>
<br>
<jsp:getProperty property="content" name="article_a" /><br>
applicationScope:${applicationScope.article_a.content }<br>

<br><br><br>
<%=request.getParameter("username") %><br>



</body>
</html>